package com.sy.simpleegg.mvp.contract

import com.sy.simpleegg.base.IModel
import com.sy.simpleegg.base.IPresenter
import com.sy.simpleegg.base.IView
import com.sy.simpleegg.bean.CashGoodBean
import com.sy.simpleegg.bean.CheckSaveCoinsResultBean
import com.sy.simpleegg.bean.CouponInfoBean
import com.sy.simpleegg.bean.GetWithdrawalCodeResult
import com.sy.simpleegg.bean.GoodBean
import com.sy.simpleegg.bean.GoodListBean
import com.sy.simpleegg.bean.LocalWithdrawalOrderBean
import com.sy.simpleegg.bean.PayTypeData
import com.sy.simpleegg.bean.RepCashDataBean
import com.sy.simpleegg.bean.RepWriteOffDataBean
import com.sy.simpleegg.bean.ReqBackscanPayBean
import com.sy.simpleegg.bean.ReqPayCodeBean
import com.sy.simpleegg.bean.ReqStartResultBean
import com.sy.simpleegg.bean.SaveCoinLoginBean
import com.sy.simpleegg.bean.SaveMoneyResult
import com.sy.simpleegg.constant.PayState
import com.sy.simpleegg.platform.BackstagePlatform
import com.sy.simpleegg.room.entity.OrderEntity

interface HomeContract {
    interface View : IView {
        fun showAd()

        fun refreshDatas(platform: BackstagePlatform, goodListBean: GoodListBean?)

        fun getPayCode(reqPayCodeBean: ReqPayCodeBean?)

        fun postResult(reqStartResultBean: ReqStartResultBean?)

        fun showCoinsInfo(k: String, coins: String, outOrSave: Boolean, finish: Boolean)

        fun postBackscanPay(reqBackscanPayBean: ReqBackscanPayBean?)

        fun showCashGoods(cashGoods: MutableList<CashGoodBean>?, lastCashOrder: OrderEntity?)

        fun saveMoneyFinish(uuid: String, totalMoney: Long, coins: Long)

        fun refreshRemainCoins(coins: String)

        fun uploadCashData(repData: Any)

        fun refreshPayCode(data: String)

        fun saveCoinLogin(saveCoinLoginBean: SaveCoinLoginBean?)

        fun checkSaveCoinsResult(checkSaveCoinsResultBean: CheckSaveCoinsResultBean)

        fun getWithdrawalCode(result: GetWithdrawalCodeResult)

        fun getMultCouponChannel(result: MutableList<CouponInfoBean>)

        fun repWiteOffData(result: RepWriteOffDataBean?)

        fun placeCashOrder(money: String, coins: String, uuid: String)

        fun placeLocalWithdrawalOrder(reqStartResultBean: ReqStartResultBean?)

    }

    interface Presenter : IPresenter<View> {
        fun initHandleJob()

        fun recieveOrder(platform: BackstagePlatform, extRepData: Any?, orderData: Any)

        fun saveGoods(platform: BackstagePlatform, dataList: Any)

        fun getPayCode(goodBean: GoodBean, payTypeData: PayTypeData?)

        fun setOrderTimeout(k: String)

        fun coinResponse(finish: Boolean, success: Boolean, coins: String)

        fun outCoins(coins: Long)

        fun clearSelectGood()

        fun postBackscanData(type: Int, scanData: String, goodBean: GoodBean? = null, scanDataType: String = "")

        fun getCashGoods(platform: BackstagePlatform)

        fun cashPayOut(platform: BackstagePlatform, money: String, coins: String)

        fun localWithdrawalOut(platform: BackstagePlatform, uid: String, coins: String)

        fun getLastCashOrder()

        fun saveMoney(checkMoney: Long, totalMoney: Long)

        fun loadCoins()

        fun refreshPayCode(data: String)

        fun insertSaveCoin(userInfo: Any)

        fun refreshSaveCoins(orderNumber: String, coins: String)

        fun checkSaveCoins(orderNumber: String, userId: String, transId: String, coins: String)

        fun recieveWithdrawalOrder(platform: BackstagePlatform, orderData: Any)

        fun getWithdrawalCode(platform: BackstagePlatform)

        fun getMultCouponChannel(platform: BackstagePlatform)

        fun repWiteOffData(platform: BackstagePlatform, channel: String, codeData: String)

        fun recieveWriteOffOrder(platform: BackstagePlatform, orderData: Any)

        fun placeLocalWithdrawalOrder(platform: BackstagePlatform, uid: String, quantity: Int)

        fun setSaveStatus(platform: BackstagePlatform, isSaving: Boolean)

        fun dispenserOrder(platform: BackstagePlatform, repCashDataBean: RepCashDataBean)

        fun getHandling(): Boolean

    }

    interface Model : IModel {
        fun getPackage()

        suspend fun saveGoods(platform: BackstagePlatform, dataList: Any): GoodListBean?

        suspend fun getPayCode(goodBean: GoodBean, payTypeData: PayTypeData?): ReqPayCodeBean?

        suspend fun checkOrder(order: OrderEntity, isCash: Boolean): OrderEntity?

        suspend fun checkOrderByCoins(order: OrderEntity, isCash: Boolean): OrderEntity?

        suspend fun setOrderTimeout(k: String)

        suspend fun postResult(platform: BackstagePlatform, k: String, success: Boolean, money: String, realOutCoins: Long, needCoins: Long, isMqOrder: Boolean, isWriteOff: Boolean, isWithdrawal: Boolean, isCash: Boolean, uid: String): ReqStartResultBean?

        suspend fun outCoins(coins: Long)

        fun clearSelectGood()

        suspend fun postBackscanData(type: Int, scanData: String, goodBean: GoodBean?, scanDataType: String): ReqBackscanPayBean?

        suspend fun getCashGoods(platform: BackstagePlatform): MutableList<CashGoodBean>?

        suspend fun cashPayOut(platform: BackstagePlatform, money: String, coins: String): RepCashDataBean?

        suspend fun localWithdrawalOut(platform: BackstagePlatform, uid: String, coins: String): LocalWithdrawalOrderBean

        suspend fun getLastCashOrder(platform: BackstagePlatform): MutableList<OrderEntity>?

        suspend fun getLastNormalOrder(platform: BackstagePlatform): MutableList<OrderEntity>?

        suspend fun getLastRechargeOrder(platform: BackstagePlatform): MutableList<OrderEntity>?

        fun setCurrentCashOrder(cashOrder: OrderEntity?)

        /**
         * 保存纸钞数据
         * @param checkMoney 当前进钞面额
         * @param totalMoney 总金额
         */
        suspend fun saveMoney(checkMoney: Long, totalMoney: Long): SaveMoneyResult?

        suspend fun saveOrder(order: OrderEntity)

        suspend fun loadCoins(): String

        suspend fun refreshPayCode(data: String): String

        suspend fun updateResult(uuid: String, realCoins: String, result: PayState)

        suspend fun updateOrder(order: OrderEntity)

        suspend fun insertSaveCoin(userInfo: Any): SaveCoinLoginBean?

        suspend fun refreshSaveCoins(orderNumber: String, coins: String)

        suspend fun checkSaveCoins(orderNumber: String, userId: String, transId: String, coins: String): CheckSaveCoinsResultBean

        suspend fun getWithdrawalOrder(orderNumber: String): OrderEntity?

        suspend fun getWriteOffOrder(orderNumber: String): OrderEntity?

        suspend fun getWithdrawalCode(platform: BackstagePlatform): GetWithdrawalCodeResult?

        suspend fun getMultCouponChannel(platform: BackstagePlatform): MutableList<CouponInfoBean>?

        suspend fun repWiteOffData(platform: BackstagePlatform, channel: String, codeData: String): RepWriteOffDataBean?

        suspend fun placeLocalWithdrawalOrder(platform: BackstagePlatform, k: String, success: Boolean, money: String, realOutCoins: Long, needCoins: Long, isMqOrder: Boolean, isWriteOff: Boolean, isWithdrawal: Boolean, isCash: Boolean, uid: String): ReqStartResultBean?

    }
}